<?php

namespace App\Http\Requests;

use App\Http\Constants\VerificationModeConstants;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class CoinsApplicationUpdateTypeRequest extends FormRequest
{
    use CommonRequest;
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $rules = [
            'verify_type' => [
                'required',
                Rule::in(array_column(VerificationModeConstants::VERIFICATION_MODE,'value'))
            ],
        ];
        $rules = array_merge($rules,CoinsApplicationRequest::baseRules());

        return $rules;
    }


    public function messages()
    {
        $verify_type_in_msg = implode('or',array_column(VerificationModeConstants::VERIFICATION_MODE,'label'));
        $messages = [
            'verify_type.required' => '验证模式,选项不能为空',
            'verify_type.in' => '验证模式 选项只能是:'.$verify_type_in_msg,
        ];
        $messages = array_merge($messages,CoinsApplicationRequest::baseMessages());

        return $messages;
    }
}
